#include <bits/stdc++.h>
#include <conio.h>
#include <cstdio>
#include <windows.h>

using namespace std;

double times, a = 1000;
char key;
int main() {
    printf("请输入准备按下的按键（字母或数字）：");
    scanf("%c", &key);
    if (int(key) >= 'a' && int(key) <= 'z')
        key -= 32;
    printf("请输入需求CPS（建议不超过50）：");
    scanf("%lf", &times);
    printf("按%c开始连点\n", key);
    double time = a / (times + 0.1 * times);
    while (true) {
        if (GetAsyncKeyState(key)) {
            mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
            Sleep(time);
        }
    }
    return 0;
}